package utils

import "strings"

var (
	escaper = strings.NewReplacer(
		`\\`, `\`,
		`\^`, `^`,
		`\$`, `$`,
		`\.`, `.`,
		`\*`, `*`,
		`\+`, `+`,
		`\?`, `?`,
		`\{`, `{`,
		`\}`, `}`,
		`\(`, `(`,
		`\)`, `)`,
		`\[`, `[`,
		`\]`, `]`,
		`\|`, `|`,
	)
)

func Replace(s string) string {
	return escaper.Replace(s)
}

func ContainHeader(headers []string, header string) bool {
	for _, h := range headers {
		if h == header {
			return true
		}
	}
	return false
}
